package ca.ericslandry.shared.event;

import ca.ericslandry.shared.domain.User;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class UserUpdatedEvent extends GwtEvent<UserUpdatedEvent.Handler> {
	public interface Handler extends EventHandler {
		void onUserUpdated(UserUpdatedEvent event);
	}

	public static Type<UserUpdatedEvent.Handler> TYPE = new Type<UserUpdatedEvent.Handler>();
	private User updatedUser;

	public UserUpdatedEvent(User updatedUser) {
		this.updatedUser = updatedUser;
	}

	@Override
	protected void dispatch(UserUpdatedEvent.Handler handler) {
		handler.onUserUpdated(this);
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<UserUpdatedEvent.Handler> getAssociatedType() {
		return TYPE;
	}

	public User getUpdatedUser() {
		return updatedUser;
	}
}
